<template>
  <div>
    <!-- 设置 -->
    <div class="common-layout">
      <el-container>
        <el-aside :width="isCollapse ? '40px' : '150px'">
          <el-menu
            default-active="2"
            class="el-menu-vertical-demo"
            router
            :collapse="isCollapse"
            :collapse-transition="false"
            :unique-opened="true"
          >
            <el-sub-menu index="1">
              <template #title>
                <img
                  src="../../assets/img/an.png"
                  style="width: 0.875rem; height: 0.875rem"
                />
                <span class="ml4">账号与安全</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="/stagingPassword">修改密码</el-menu-item>
              </el-menu-item-group>

              <el-menu-item-group>
                <el-menu-item index="/stagingInfo">账号信息维护</el-menu-item>
              </el-menu-item-group>
            </el-sub-menu>

            <el-sub-menu index="2">
              <template #title>
                <img
                  src="../../assets/img/身份.png"
                  style="width: 0.875rem; height: 0.875rem"
                />
                <span class="ml4">身份信息</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="/stagingmaintenance"
                  >身份信息维护</el-menu-item
                >
              </el-menu-item-group>
            </el-sub-menu>
          </el-menu>
        </el-aside>
        <el-container>
          <el-header class="top">
            <img
              src="../../assets/img/aside.png"
              style="width: 20px; height: 18px; cursor: pointer"
              @click="cop()"
            />

            <el-button type="primary" class="btn">
              {{ route.meta.title }}
            </el-button>
          </el-header>

          <el-main style="margin: -10px 0 -10px -10px">
            <router-view></router-view>
          </el-main>
        </el-container>
      </el-container>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import { useRoute, useRouter } from "vue-router";
const route = useRoute();
const isCollapse = ref(false);
const list = ref([]);
const cop = () => {
  isCollapse.value = !isCollapse.value;
};
</script>
<style>
.el-menu {
  border-right: 0 !important;
}
</style>
<style lang="scss" scoped>
.common-layout {
  background-color: #eef0f6;
  height: calc(100vh - 4.375rem);
}
.top {
  height: 60px;
  background: #ffffff;
  display: flex;
  align-items: center;
  padding-left: 20px;
  box-sizing: border-box;
  margin-left: 10px;
  .btn {
    width: 114px;
    height: 30px;
    background: #f43107;
    border-radius: 4px;
    border: 0;
    margin-left: 20px;
  }
}
.el-menu-vertical-demo {
  width: 150px;
  height: calc(100vh - 80px);
  background: #ffffff;
}

.el-menu-item.is-active {
  color: #f43107;
  background-color: #fff;
}
</style>
